<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>layui-hello</title>
    <link rel="stylesheet" href="../lib/layui/layui-v2.6.8/layui/css/layui.css">
</head>
<body>
<button class="layui-btn layui-btn-danger">按钮1</button>

<table class="layui-table" id="test"></table>
</body>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
        <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
        <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
    </div>
</script>

<script src="../lib/layui/layui-v2.6.8/layui/layui.js"></script>
<script>
    var cols = [[
        {
            field: 'name',
            title: '姓名'
        }, {
            field: 'dept',
            title: '部门'
        }
    ]]

    layui.use('table', function () {
        var table = layui.table;
        table.render({
            elem: '#test',
            url: '../mock/employee.json',
            cols: cols,
            page: true,
            toolbar:'#toolbarDemo'
        })
    })


</script>

</html>